﻿<UserControl x:Class="PHPVHReportViewer.Views.DynamicAnalysisDetailsControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:views="clr-namespace:PHPVHReportViewer.Views">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>

        <!-- Row 1 -->
        <TextBlock Text="Input Map" FontWeight="Bold" />
        <TextBlock Text="Coverage Table" Grid.Column="1" FontWeight="Bold" />

        <TreeView Grid.Row="1" x:Name="InputTreeView" Margin="0,0,4,0"
                              ItemsSource="{Binding InputTable}"
                              Background="Transparent">
            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate ItemsSource="{Binding Value}">
                    <TextBlock Text="{Binding Key,Mode=OneWay}" />
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
        </TreeView>
        <GridSplitter Width="4" HorizontalAlignment="Right" Grid.RowSpan="2"
                                VerticalAlignment="Stretch" Background="Transparent" />

        <!-- Row 2 -->
        <TreeView Grid.Column="1" Grid.Row="1"
                                      ItemsSource="{Binding CoverageTables}"
                                      Background="Transparent">
            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate ItemsSource="{Binding}">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Plugin}" />
                        <TextBlock Text=" (" />
                        <TextBlock Text="{Binding Total}" />
                        <TextBlock Text="%)" />
                    </StackPanel>
                    <HierarchicalDataTemplate.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock>
                                    <Hyperlink NavigateUri="{Binding Key}" RequestNavigate="Hyperlink_RequestNavigate">
                                        <TextBlock Text="{Binding Key}" />
                                    </Hyperlink>
                                </TextBlock>
                                <TextBlock Text=" (" />
                                <TextBlock Text="{Binding Value}" />
                                <TextBlock Text="%)" />                                
                            </StackPanel>
                        </DataTemplate>
                    </HierarchicalDataTemplate.ItemTemplate>
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
        </TreeView>
    </Grid>
</UserControl>
